Socket
Socket
Sign inDemoInstall

markdown-list-linter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-list-linter

Lint markdown lists to warn when list items are not alphabetically ordered


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Markdown List Linter

Lints markdown lists and warn when list items are not alphabetically ordered.

A complete solution

This functionality is available to be consumed in three different ways:

  • A GitHub Action as part of your CI/CD process

  • 📦 An NPM package that can be consumed in your JavaScript or TypeScript code

  • 💻 A CLI that you can run in your terminal

Installation

You can install this package in your JavaScript or Typescript project.

npm install markdown-list-linter

Usage

Very simple to use, all results will be container in the returned object.

import { lintMarkdownList } from '../src/markdown-list-linter'

const results = lintMarkdownList('./path/to/markdown/file.md')
console.log(results)

When there are no errors, the returned object should look something like this. The property formattedMessage is supplied if you need to print the output to a terminal console.

{
  'summary': 'No errors found',
  'formattedMessage': 'SUMMARY:\nNo errors found\n'
}

When there are errors, the returned object should look something like this.

{
  'summary': 'Markdown list needs to be sorted',
  'errorObject': [
      {
          'type': 'HEADINGS',
          'message': 'Please correct the alphabetical order for these heading items',
          'details': [
            ['C'],
            ['D', 'A']
          ],
      },
      {
          'type': 'LIST_ITEMS',
          'message': 'Please correct the alphabetical order for these list items',
          'details': [
            [
                `[African Buffalo]('https://www.AfricanBuffalo.com')`,
                `[Aardwolf]('https://www.Aardwolf.com')`
            ]
          ],
      }
  ],
  'formattedMessage': "SUMMARY:\nMarkdown list needs to be sorted\n\nDETAILS:\nPlease correct the alphabetical order for these heading items\n\tSection #1\n\t\tD\n\t\tA\n\t\tB\n\t\tC\n\nPlease correct the alphabetical order for these list items\n\tSection #1\n\t\t[African Buffalo]('https://www.AfricanBuffalo.com')\n\t\t[Aardwolf]('https://www.Aardwolf.com')\n\n\"
}

The array items in the details object is sections in the list which need to be reordered.

Keywords

FAQs

Package last updated on 10 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc